<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>订单列表</title>
		<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css" type="text/css" />
		<script src="<%=request.getContextPath()%>/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script src="<%=request.getContextPath()%>/resources/js/bootstrap.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/jquery-heima-0.0.1.js" ></script>
	</head>

	<body>
		<div class="container-fluid"  style="max-width: 1370px;">
			<div class="container">
				<div class="row">
					<div style="margin:0 auto; margin-top:10px;width:950px;">
						<table class="table table-bordered">
							<tbody id="dindan">
							<c:forEach items="${pb.list}" var="i">
							<tr class="success">
								<th colspan="2">
									订单编号:
									<a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder">
											${i.oid}
									</a>
								</th>
								<c:if test="${i.state==0}">
								<th colspan="1">订单状态:<span>  未付款</span></th>
								</c:if>
								<c:if test="${i.state==1}">
								<th colspan="1">订单状态:<span>  已付款</span></th>
								</c:if>
								<c:if test="${i.state==2}">
								<th colspan="1">订单状态:<span>  已发货</span></th>
								</c:if>
								<c:if test="${i.state==3}">
								<th colspan="1">订单状态:<span>  已完成</span></th>
								</c:if>
								<c:if test="${i.state==4}">
									<th colspan="1">订单状态:<span>  回收站</span>
										<form action="<%=request.getContextPath()%>/adminServlet" method="post">
											<input type="hidden" name="oid" value="${i.oid}">
											<input type="hidden" name="method" value="recoveryOrder">
											<input type="submit" value="恢复">
										</form>
									</th>
								</c:if>
								<th colspan="2">下单时间: ${i.ordertime} </th>
							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>

								<c:forEach items="${i.orderViewList}" var="a">
									<tr class="active">
										<td width="20">
											<img src="<%=request.getContextPath()%>/${a.pimage}" width="70" height="60">
										</td>
										<td width="30%">
											${a.pname}
										</td>
										<td width="20%">
											￥${a.shop_price}
										</td>
										<td width="10%">
											${a.count}
										</td>
										<td width="20%">
											<span class="subtotal">￥${a.subTotal}</span>
										</td>
									</tr>
								</c:forEach>
								<c:if test="${i.state==1}">
									<tr bgcolor="aqua" style="text-align: center">
										<th width="20%">收货人:${i.name}</th>
										<th width="30%">收货地址：${i.address}</th>
										<th>收货人手机号:<br>${i.telephone}</th>
										<th colspan="2"><form action="<%=request.getContextPath()%>/adminServlet" method="post">
											<input type="hidden" name="method" value="editCourierNum">
											<input type="hidden" name="oid" value="${i.oid}">
											订单号：<input type="text" name="couriernum"><input type="submit" value="发货">
										</form></th>
									</tr>
								</c:if>
								<c:if test="${i.state==2||i.state==3||i.state==4}">
									<tr bgcolor="aqua" style="text-align: center">
										<th width="20%">收货人:${i.name}</th>
										<th width="30%">收货地址：${i.address}</th>
										<th>收货人手机号:${i.telephone}</th>
										<th colspan="2">订单号:${i.couriernum}
											<form action="<%=request.getContextPath()%>/view/admin/order/edit.jsp" method="post">
												<input type="hidden" name="oid" value="${i.oid}">
												<input type="submit" value="修改">
											</form>
										</th>
									</tr>
								</c:if>

							</c:forEach>

							</tbody>
						</table>
					</div>
				</div>
				<div style="text-align: center;">
					<ul class="pagination" id="pagination">
						<c:if test="${pb.currentPage>1}">
							<li><a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder&pagenum=${pb.currentPage-1}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
						</c:if>
						<c:if test="${pb.currentPage<=1}">
							<li><a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder&pagenum=1" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
						</c:if>

						<c:forEach begin="1" end="${pb.totalPage}" var="i" >
							<c:if test="${pb.currentPage==i}">
								<li class="active"><a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder&pagenum=${i}">${i}</a></li>
							</c:if>
							<c:if test="${pb.currentPage!=i}">
								<li><a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder&pagenum=${i}">${i}</a></li>
							</c:if>
						</c:forEach>

						<c:if test="${pb.currentPage<pb.totalPage}">
							<li><a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder&pagenum=${pb.currentPage+1}" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
						</c:if>
						<c:if test="${pb.currentPage>=pb.totalPage}">
							<li><a href="<%=request.getContextPath()%>/adminServlet?method=selAllOrder&pagenum=${pb.totalPage}" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
						</c:if>
					</ul>
				</div>
			</div>
		</div>
	</body>
</html>